//
//  signInforCollectionCell.m
//  doubleEduStudents
//
//  Created by 盛洋 on 2021/1/14.
//  Copyright © 2021 shengYang. All rights reserved.
//

#import "signInforCollectionCell.h"

@implementation signInforCollectionCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.status_btn.titleLabel.font = self.restTime_lab.font = AutoLabFont3;
    self.join_btn.titleLabel.font = self.date_lab.font = self.look_lab.font = self.peopleCount_lab.font = self.down_lab.font = AutoLabFont2;
    [self.contentView sendSubviewToBack:self.back_img];    
}

-(void)setDic:(NSDictionary *)dic{
    _dic = dic;
    if ([_dic[@"status"] integerValue] == 0) {
        //未开始
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_unstart"] forState:UIControlStateNormal];
        [_status_btn setTitle:@"未开始" forState:UIControlStateNormal];
        [self.join_btn setHidden:YES];
        self.restTime_lab.text = @"";
    }else if ([_dic[@"status"] integerValue] == 1){
        //报名中
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_ing"] forState:UIControlStateNormal];
         [_status_btn setTitle:@"报名中" forState:UIControlStateNormal];
        [self.join_btn setHidden:NO];
        [self.join_btn setTitle:@"立即报名" forState:UIControlStateNormal];
        //剩余时间
        self.restTime_lab.text = [NSString stringWithFormat:@"%@",_dic[@"matchDayStartEnd"]];
    }else if ([_dic[@"status"] integerValue] == 2){
        //评奖中
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_start"] forState:UIControlStateNormal];
         [_status_btn setTitle:@"评奖中" forState:UIControlStateNormal];
        [self.join_btn setHidden:YES];
        self.restTime_lab.text = @"";

    }else if ([_dic[@"status"] integerValue] == 3){
        //已结束
        [_status_btn setBackgroundImage:[UIImage imageNamed:@"aliefu_unstart"] forState:UIControlStateNormal];
         [_status_btn setTitle:@"已结束" forState:UIControlStateNormal];
        [self.join_btn setHidden:NO];
        self.restTime_lab.text = @"";
        [self.join_btn setTitle:@"作品展示" forState:UIControlStateNormal];

    }
    [_icon_img sd_setImageWithURL:[NSURL URLWithString:_dic[@"photo"]] placeholderImage:[UIImage imageNamed:@"back_center"]];
    _look_lab.text = [NSString stringWithFormat:@"浏览数：%ld",[_dic[@"lookPeople"] integerValue]];
    _peopleCount_lab.text = [NSString stringWithFormat:@"报名人数：%ld",[_dic[@"joinPeople"] integerValue]];
    _down_lab.text = [NSString stringWithFormat:@"上传作品：%ld",[_dic[@"productionNum"] integerValue]];
    NSString *startTime = [NSString stringWithFormat:@"%@",_dic[@"startTime"]];
    if (startTime.length > 10) {
        startTime= [startTime substringToIndex:10];
    }else{
        startTime = startTime;
    }
    NSString *endTime = [NSString stringWithFormat:@"%@",_dic[@"endTime"]];

    if (endTime.length > 10) {
        endTime = [endTime substringToIndex:10];
    }else{
        endTime = endTime;
    }
    _date_lab.text = [NSString stringWithFormat:@"活动时间：%@ —— %@",startTime,endTime];
    
}

@end
